package com.qf.qflivehou.controller;

import com.qf.qflivehou.pojo.reqVo.OrderReq2;
import com.qf.qflivehou.pojo.respVo.ResponseData;
import com.qf.qflivehou.service.PayService;
import org.apache.catalina.servlet4preview.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.Liu
 * @date 2022/1/13 17:56
 */

/**
 * 支付业务接口层
 */
@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private PayService payService;

    /**
     * 用户支付接口
     * @param orderReq2
     * @param request
     * @return
     */
    @PostMapping("/alipay")
    public ResponseData alipay(@RequestBody OrderReq2 orderReq2, HttpServletRequest request){
        ResponseData responseData = payService.alipay(orderReq2,request);
        return responseData;
    }

    /**
     *支付宝的接口回调
     * @param request
     */
    @RequestMapping("/returnUrl")
    public void returnUrl(HttpServletRequest request){
        payService.returnUrl(request);
    }
}
